package thread;

import java.sql.Time;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;

public class Demo25 {
    public static void main(String[] args) throws InterruptedException {
        ExecutorService threadPool = Executors.newCachedThreadPool();
        for (int i = 0; i < 10000; i++) {
            int id = i;
            threadPool.submit(() -> {
                System.out.println("hello"+id+","+Thread.currentThread().getName());
            });
        }
        threadPool.shutdown();
        threadPool.awaitTermination(3000,TimeUnit.MILLISECONDS);
    }
}
